﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BiffenGUI.BiffenService;

namespace BiffenGUI.UserControls
{
    public partial class ShowDetails : UserControl
    {
        private MemberAddBookingCreate parent = null;
        private Show show = null;

        public ShowDetails()
        {
            InitializeComponent();
        }

        public void Update(Show s, MemberAddBookingCreate p)
        {
            parent = p;
            show = s;

            DateTime dt = s.StartTime;
            string dayName = GetDayName(dt.DayOfWeek);
            string day = dt.Day.ToString();
            string month = GetMonthName(dt.Month);
            string year = dt.Year.ToString();

            lblDate.Text = dayName + " d. " + day + ". " + month + " " + year;
            lblTime.Text = "Kl. " + dt.ToShortTimeString();
            lblTheater.Text = "Sal " + s.Theater.Id.ToString();
        }

        public Show GetShow()
        {
            return show;
        }

        internal string GetDayName(DayOfWeek d)
        {
            switch (d)
            {
                case DayOfWeek.Friday:
                    return "Fredag";
                case DayOfWeek.Monday:
                    return "Mandag";
                case DayOfWeek.Saturday:
                    return "Lørdag";
                case DayOfWeek.Sunday:
                    return "Søndag";
                case DayOfWeek.Thursday:
                    return "Torsdag";
                case DayOfWeek.Tuesday:
                    return "Tirsdag";
                case DayOfWeek.Wednesday:
                    return "Onsdag";
                default:
                    return "";
            }
        }

        internal string GetMonthName(int month)
        {
            switch (month)
            {
                case 1:
                    return "januar";
                case 2:
                    return "februar";
                case 3:
                    return "marts";
                case 4:
                    return "april";
                case 5:
                    return "maj";
                case 6:
                    return "juni";
                case 7:
                    return "juli";
                case 8:
                    return "august";
                case 9:
                    return "september";
                case 10:
                    return "oktober";
                case 11:
                    return "november";
                case 12:
                    return "december";

                default:
                    return "";
            }
        }

        private void ShowDetails_Click(object sender, EventArgs e)
        {
            parent.SetSelectedShow(show, this);
            this.BackColor = SystemColors.ControlDark;
        }

    }
}
